#include<stdio.h>
#include<stdlib.h>
typedef struct LNode{
	int data;
	struct LNode *next;
}LNode,*LinkList;
void InitList(LinkList &L){
	L=(LinkList)malloc(sizeof(LNode));//L=new LinkList;
	L->next=NULL;
}
void CreateListR(LinkList &L,int n){
    int i,j;
    LinkList s,r;
    r=L;
    for(i=0;i<n;i++){
            scanf("%d",&j);
        s=(LinkList)malloc(sizeof(LNode));
        s->data=j;
        r->next=s;
        r=s;
    }
    r->next=NULL;
}
void Union(LinkList ha,LinkList hb,LinkList &hc){
    hc=(LinkList)malloc(sizeof(LNode));
    	LinkList s1,s2,r,s;
	s1=ha->next;
	s2=hb->next;
    r=hc;
	while(s1!=NULL&&s2!=NULL){
		if(s1->data<s2->data){
			s=(LinkList)malloc(sizeof(LNode));
			s->data=s1->data;
			r->next=s;
			r=s;
			s1=s1->next;
		}
		else {
		   s=(LinkList)malloc(sizeof(LNode));
			s->data=s2->data;
			r->next=s;
			r=s;
			s2=s2->next;
		}
		
	}
	if(s1!=NULL){
		r->next=s1;
	}
	if(s2!=NULL){
		r->next=s2;
	}
}
int mid(LinkList &S3){
	int len=0,i;
	LinkList p=S3->next;
     while(p!=NULL){
        len++;
        p=p->next;
    }
    len--;
    p=S3->next;
    for(i=0;i<len/2;i++){
    	p=p->next;
	}
   return p->data;
}
int main(){
    int i,n;
    int len=0,m,e;
    scanf("%d",&n);
    LinkList S1,S2,S3;
    
    InitList(S1);
    InitList(S2);
    InitList(S3);
    CreateListR(S1,n);
    CreateListR(S2,n);
    Union(S1,S2,S3);
    e=mid(S3);
    printf("%d",e);
    return 0;
    } 
